var sorl = sorl || {};
sorl.curator = sorl.curator || {};
sorl.curator.tinymce = sorl.curator.tinymce || {};

sorl.curator.tinymce.init = {
    mode : "specific_textareas",
    editor_selector : "mceEditor",
    theme : "advanced",
    language: "sv",
    editor_css : "../css/tinymce/editor.css",
    content_css : tinyMCE.baseURI['directory'] + "/../css/tinymce/content.css",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    theme_advanced_statusbar_location : "",
    theme_advanced_buttons1 : "subheading,bold,italic,|,bullist,numlist,|,link,unlink,image,|,pastetext,pasteword,|,undo,redo,|,code,|,pagebreak,fullscreen",
    theme_advanced_buttons2 : "",
    theme_advanced_buttons3 : "",
    theme_advanced_path : true,
  	theme_advanced_statusbar_location : "bottom",
    width: '600',
    height: '300',
    plugins : "subheading,fullscreen,pastecurator,safari,pagebreak,inlinepopups,contextmenu",
    subheading_level : 2,
    relative_urls : false,
    browsers: "msie,gecko,safari,opera",
    paste_create_linebreaks : false,
    paste_use_dialog : true,
    paste_auto_cleanup_on_paste : true,
    paste_convert_middot_lists : false,
    paste_convert_headers_to_strong : true,
    entity_encoding : "raw",
    fix_table_elements : true,
    file_browser_callback : 'sorl.curator.tinymce.callback',
    external_link_list_url : '../link_list/'
}

sorl.curator.tinymce.image_url = '/admin/images/image/';

sorl.curator.tinymce.callback = function(field_name, url, type, win) {
    if (type == 'image') {
        tinyMCE.activeEditor.windowManager.open({
            file : sorl.curator.tinymce.image_url + '?pop',
            title : 'Bildbläddrare',
            width : 800,
            height : 485,
            resizable : "yes",
            inline : "yes",
            close_previous : "no"
        }, {
            window : win,
            input : field_name
        });
        return false;
    }
}
